package com.example.demo.file;

import com.csvreader.CsvWriter;

import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;

public class TextTocsv {
    private static String path = "E:\\text/";

    public static void main(String[] args) {
        String readFile = path + "newfile.csv";
        String writeFile = path + "result.csv";
        File file = new File(readFile);
        ArrayList<ArrayList<String>> list = new ArrayList<ArrayList<String>>();
        try {
            CsvWriter csvWriter = new CsvWriter(path + "newfile.csv", ',', Charset.forName("UTF-8"));
            FileReader fileReader = new FileReader(file);
            BufferedReader bufferedReader = new BufferedReader(fileReader);
            String string = "";
            while ((string = bufferedReader.readLine()) != null) {
                String[] s = string.split(" | +");
              //  csvWriter.writeRecord(s);
            }
        //    csvWriter.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
